package com.test3;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSON;

public class Test3 {
	
	static Logger log = LoggerFactory.getLogger(Test3.class);
	
	private ThreadPoolExecutor tt = Executor.get();
	
	public static void main(String[] args) {
		Test3 tt = new Test3();
		tt.run();
	}
	
	public void run() {
		for(int i=0;i<=40;i++) {
			int index = i;
			CompletableFuture.runAsync(()->{
				try {
					Thread.sleep(10000);
					log.info("任务index"+index);					
				} catch (Exception e) {
					log.error(e.getMessage());
				}
			},tt);
		}
		this.getCounts();
	}
	
	public void getCounts() {		
		System.out.println(tt.getActiveCount());
		System.out.println(tt.getTaskCount());
		System.out.println(tt.getPoolSize());
		System.out.println(tt.getMaximumPoolSize());
	}

}
